/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chess;

import java.awt.Desktop;
import java.awt.event.*;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

/**
 *
 * @author houfukude
 */
public class MenuAction implements ActionListener{

    public void actionPerformed(ActionEvent e) {
                if(e.getActionCommand().equals("Exit")){
                    System.exit(0);//退出程序
                }
                if(e.getActionCommand().equals("Start")){
                    chess chess = new chess();
                    //ChessPad.restart();
                }
                if(e.getActionCommand().equals("Black")){

                }
                if(e.getActionCommand().equals("White")){

                }
                if(e.getActionCommand().equals("Help")){
            try{
                SeeHelp();//打开帮助网站
            }catch(URISyntaxException e2){

            }catch(IOException e3){

            }

        }
                //throw new UnsupportedOperationException("Not supported yet.");
            }

             public void SeeHelp()throws IOException,URISyntaxException{
                 Desktop dt;//调用桌面信息
                 if(Desktop.isDesktopSupported()){
                     dt = Desktop.getDesktop();//访问网页
                     dt.browse(new URI("http://www.cqut.edu.cn/"));
                 }
             }

}
